package com.xiaoyang.ssyx.product.config;

import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @AUTHOR XiaoYang
 * @DATE 2023/6/16-12:22
 * @DESCRIPTION TODO
 */
@Slf4j
@Configuration
public class MinioClientConfig {

    @Value("${minio.url}")
    private String url;

    @Value("${minio.access-key}")
    private String accessKey;

    @Value("${minio.secret-key}")
    private String secretKey;

    /**
     * 注入minio客户端
     */
    @Bean
    public MinioClient minioClient() {
        log.info("minioClient");
        return MinioClient.builder()
                .endpoint(url)
                .credentials(accessKey, secretKey)
                .build();
    }
}

